package com.ocom.oauth.controller;


import com.ocom.common.utils.RequestUtil;
import com.ocom.oauth.po.LoginPo;
import com.ocom.oauth.utils.UrlUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class XcxLoginController {

    @PostMapping("/xcx/login")
    public String login(@RequestBody LoginPo loginPo){
        System.out.println(loginPo);
        Map<String,Object> requstMap =new HashMap<>();
        requstMap.put("grant_type",loginPo.getGrant_type());
        requstMap.put("client_id",loginPo.getClient_id());
        requstMap.put("client_secret",loginPo.getClient_secret());
        requstMap.put("wx_code",loginPo.getWx_code());
        requstMap.put("com_id",loginPo.getCom_id());
        RequestUtil requestUtil = new RequestUtil();
        String res = requestUtil.doPostForm(UrlUtil.getUrl()+"/login", requstMap);
        return res;
    }
}
